/*
** prcoess_amps.c for  in /home/georgi_v/rendu/PSU_2013_my_printf
** 
** Made by georgi_v
** Login   <georgi_v@epitech.net>
** 
** Started on  Sun Nov 17 08:14:51 2013 georgi_v
** Last update Fri Dec  6 19:41:38 2013 georgi_v
*/

#include "my.h"

void    process_amps(const char *str, int *bcnt)
{
  int   index;
  int   cnt;

  index = *bcnt + 1;
  cnt = 1;
  while (str[index++] == '%')
    cnt++;
  *bcnt = *bcnt + cnt;
  if (cnt != 0)
    {
      if (cnt == 1)
	my_putchar('%');
      else
	{
	  if (cnt % 2 == 1)
	    cnt++;
	  cnt = cnt  / 2 ;
	  while (cnt > 0)
	    {
	      my_putchar('%');
	      cnt--;
	    }
	}
    }
}
